﻿using System;
using System.Collections.Generic;

namespace FinMkts
{
    /// <summary>
    /// A tradeable financial product.
    /// </summary>
    /// <example>
    /// share, bond, interest rate, commodity
    /// </example>
    public abstract class FinancialInstrument
    {
        public virtual Guid Id { get; set; }

        /// <summary>
        /// The name of this instrument
        /// </summary>
        public virtual string Name { get; set; }

        /// <summary>
        /// Used to buy and sell this instrument, typically a currency but can be something else, e.g. Gold
        /// </summary>
        public virtual string CurrencyCode { get; set; }

        /// <summary>
        /// Used to buy and sell this instrument, typically a currency but can be something else, e.g. Gold
        /// </summary>
        public virtual Currency PricedIn { get; set; }

        /// <summary>
        /// Where this instrument can be traded
        /// </summary>
        public virtual ICollection<MarketListing> MarketListings { get; set; }

        /// <summary>
        /// The codes of this listing, e.g. the ISIN
        /// </summary>
        public virtual ICollection<InstrumentCode> Codes { get; set; }

        public bool IsDerivative
        {
            get { return CanGetUnderliners; }
        }

        public virtual bool CanGetUnderliners
        {
            get { return false; }
        }

        public abstract string TypeName { get; }

        /// <summary>
        /// The things this instrument is based on
        /// </summary>
        public virtual IEnumerable<FinancialInstrument> GetUnderliners()
        {
            throw new NotImplementedException();
        }

    }
}